<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/views/include/easyui.jsp"%>
<script src="${ctx}/static/plugins/My97DatePicker/WdatePicker.js"
	type="text/javascript"></script>

</head>
<body style="font-family: '微软雅黑'">
	<div id="tb" style="padding: 5px; height: auto">
		<div></div>

	</div>
	<table id="dg"></table>
	<div id="dlg"></div>
	<script type="text/javascript">
		var dg;
		$(function() {
			dg = $('#dg').datagrid({
				method : "get",
				url : '<%=path%>/system/permission/myGrantPermissionList',
				fit : true,
				fitColumns : true,
				border : false,
				striped : true,
				idField : 'id',
				pagination : true,
				rownumbers : true,
				pageNumber : 1,
				pageSize : 20,
				pageList : [ 10, 20, 30, 40, 50 ],
				singleSelect : true,
				columns : [ [ {
					field : 'id',
					title : 'id',
					hidden : true
				}, {
					field : 'description',
					title : '标签',
					sortable : true,
					width : 100
				}, {
					field : 'delFlag',
					title : '操作',
					formatter : function(value, row, index) {
						return "<a href='javascript:details("+row.id+")'>查看</a>|<a href='javascript:del("+row.id+")'>取消授权</a>";
					}
				} ] ],
				enableHeaderClickMenu : false,
				enableHeaderContextMenu : false,
				enableRowContextMenu : false,
				toolbar : '#tb'
			});
		});

		//弹窗增加
		function details(id) {
			d = $("#dlg").dialog({
				title : '已授权限',
				width : 500,
				height : 350,
				href : '<%=path%>/system/permission/'+id+'/myGrantPermissionDit',
				maximizable : true,
				modal : true,
				buttons : [  {
					text : '关闭',
					handler : function() {
						d.panel('close');
					}
				} ]
			});
		}

		//删除
		function del(id) {
			
			parent.$.messager.confirm('提示', '删除后无法恢复您确定要删除？', function(data) {
				if (data) {
					$.ajax({
						type : 'get',
						url : '<%=path%>/system/permission/'+id+'/myGrantPermissionDel',
						success : function(data) {
							successTip(data, dg);
						}
					});
				}
			});
		}

		//弹窗修改
		function upd() {
			var row = dg.datagrid('getSelected');
			if (rowIsNull(row))
				return;
			d = $("#dlg").dialog({
				title : '修改用户',
				width : 380,
				height : 250,
				href : '${ctx}/system/dict/update/' + row.id,
				maximizable : true,
				modal : true,
				buttons : [ {
					text : '修改',
					handler : function() {
						$('#mainform').submit();
					}
				}, {
					text : '取消',
					handler : function() {
						d.panel('close');
					}
				} ]
			});
		}

		//创建查询对象并查询
		function cx() {
			var obj = $("#searchFrom").serializeObject();
			dg.datagrid('reload', obj);
		}
	</script>
</body>
</html>